<template>
  <sc-drawer v-model="visible" title="添加优惠卷" size="700px" @cancel="$emit('close')" @confirm="confirm">
    <StudentInfoForm ref="studentInfoFormRef" :couponInfo="couponInfo"/>
  </sc-drawer>
</template>

<script setup>
import { ref, getCurrentInstance } from "vue";
import { ElMessage } from 'element-plus';
import StudentInfoForm from "@/views/discounts/coupon/coupon-form/index.vue";

const studentInfoFormRef = ref(null)
const { proxy } = getCurrentInstance();
const visible = ref(true);
const couponInfo = ref({})

function confirm() {
  studentInfoFormRef.value.validate({
    success() {
      console.log(couponInfo.value);
      // proxy.$API.student.add.post(couponInfo.value).then(res => {
      //   console.log('proxy.$API.student.add -> res', res)
      // })
    },
    error() {
      ElMessage({
        message: '请完善表单必填项',
        type: 'error',
      })
    }
  })
}
</script>

<style lang="scss" scoped>
.mr10 {
  margin-right: 10px;
}
</style>
